﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Coolite.Ext.Web;
using Sagacity.NC.Entity.SysEntity;
using System.Collections.Generic;

namespace Sagacity.NC.Web
{
    public partial class SysModules : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Sagacity.Entity.Build.ResourceInfo resourceInfo = new Sagacity.Entity.Build.ResourceInfo();
            Sagacity.Entity.Build.RoleInfo roleInfo = new Sagacity.Entity.Build.RoleInfo();

            resourceInfo = (new Sagacity.Build.Application.Resource()).GetResrouse(int.Parse(hidModuleRId.Value));
            roleInfo = (new Sagacity.Build.Role()).GetRoleInfo(CurrentUser.LoginRole.Id);

            DataTable dt = (new Sagacity.Build.Role()).GetRightResourceDataTable(resourceInfo, roleInfo);
            List<SysModuleInfo> modules = new List<SysModuleInfo>();
            foreach (DataRow r in dt.Rows)
            {
                SysModuleInfo module = new SysModuleInfo();
                module.ModuleId = int.Parse(r["ModuleId"].ToString());
                module.ModuleName = r["ModuleName"].ToString();
                module.ModuleCode = r["ModuleCode"].ToString();
                module.ModuleAuth = r["ModuleAuth"].ToString();
                module.ModuleDesc = r["ModuleDesc"].ToString();
                module.ModuleIcon = r["ModuleIcon"].ToString();
                module.ModuleTitlePic = r["ModuleTitlePic"].ToString();
                module.ParentId = int.Parse(r["parentid"].ToString());
                module.State = r["intstate"].ToString().ToUpper() == "TRUE" ? true : false;
                modules.Add(module);
            }

            Store1.DataSource = modules;
            Store1.DataBind();
        }
    }
}
